Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beam-search implementation for more exhausting sampling #35

Merged
merged 6 commits into from
May 13, 2023

Conversation

laurcate
Copy link

Issue #, if available:

Description of changes:
this function largely replaces A2RL Simulator.gpt_sample_n_steps(). It does not
concern states/actions/rewards and only generates the next N tokens using beam search.
This function is to be used by a BYO planner downstream as a replacement of the normal sampling strategy.

Additionally a notebook with example of implementaiton has been added.

Testing done:
Yes

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're
unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of
what we are going to look for before merging your pull request.

  • [x ] I have read the CONTRIBUTING document.
  • I have added tests that prove my fix is effective or that my feature works (if appropriate).
  • I have updated any necessary documentation, including README and docs (if appropriate).

By submitting this pull request, I confirm that my contribution is made under the terms of the
Apache 2.0 license.

requirements.txt Outdated Show resolved Hide resolved
Hopefully this fixes failing tests
@github-actions
Copy link

github-actions bot commented May 4, 2023

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/a2rl
   __init__.py21195%35
   _io.py68199%353
   simulator.py6196190%456–458, 471, 537, 543, 558–590, 596, 908, 1007, 1022, 1032, 1037, 1053, 1074, 1096, 1122, 1143, 1149, 1166, 1170, 1176, 1186, 1193, 1216, 1222, 1293, 1306–1309, 1320–1321, 1344, 1403, 1410, 1465, 1472, 1478, 1485, 1488, 1599, 1615–1617, 1626, 1650, 1689, 1692
   tokenizer.py116298%64–65
   utils.py1612286%51, 60–63, 74–76, 108, 147, 164, 179–181, 336–339, 475–484, 544, 558
src/a2rl/experimental/lightgpt
   lr_decay.py20195%30
   model.py116298%260, 263
   simulator.py35197%162
src/a2rl/mingpt
   model.py118497%57, 203, 208, 230
   trainer.py841483%50–51, 55–57, 108–111, 116, 124–126, 134, 140–141
TOTAL159210993% 

Tests Skipped Failures Errors Time
240 0 💤 4 ❌ 0 🔥 27.600s ⏱️

src/a2rl/simulator.py Outdated Show resolved Hide resolved
@verdimrc
Copy link
Contributor

verdimrc commented May 4, 2023

Thank you @laurcate , @patrick22414. Feel free to merge to main.

Ignore the linter error -- looks like a newer Black wants to reformat even files outside this PR.

Recommend you to review the missing coverage in your new function (see the coverage report a few comments above). I'm okay if you want to add extra tests for the edge cases as a separate PR.

@verdimrc verdimrc merged commit d0dab0f into main May 13, 2023
@verdimrc
Copy link
Contributor

Thank you for the additional test cases.

@verdimrc verdimrc deleted the feature/beam-search branch May 13, 2023 02:46
@verdimrc verdimrc mentioned this pull request May 16, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants